/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package amanda_gabriel_isabella_lucivania_monica.View;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 *
 * @author gabriel
 */
@Entity
@Table(name = "Professor_Turma", catalog = "amanda_gabriel_isabella_lucivania_monica", schema = "")
@NamedQueries({
    @NamedQuery(name = "ProfessorTurma.findAll", query = "SELECT p FROM ProfessorTurma p"),
    @NamedQuery(name = "ProfessorTurma.findByProfessorId", query = "SELECT p FROM ProfessorTurma p WHERE p.professorTurmaPK.professorId = :professorId"),
    @NamedQuery(name = "ProfessorTurma.findByTurmaId", query = "SELECT p FROM ProfessorTurma p WHERE p.professorTurmaPK.turmaId = :turmaId")})
public class ProfessorTurma implements Serializable {
    @Transient
    private PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected ProfessorTurmaPK professorTurmaPK;

    public ProfessorTurma() {
    }

    public ProfessorTurma(ProfessorTurmaPK professorTurmaPK) {
        this.professorTurmaPK = professorTurmaPK;
    }

    public ProfessorTurma(int professorId, int turmaId) {
        this.professorTurmaPK = new ProfessorTurmaPK(professorId, turmaId);
    }

    public ProfessorTurmaPK getProfessorTurmaPK() {
        return professorTurmaPK;
    }

    public void setProfessorTurmaPK(ProfessorTurmaPK professorTurmaPK) {
        this.professorTurmaPK = professorTurmaPK;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (professorTurmaPK != null ? professorTurmaPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ProfessorTurma)) {
            return false;
        }
        ProfessorTurma other = (ProfessorTurma) object;
        if ((this.professorTurmaPK == null && other.professorTurmaPK != null) || (this.professorTurmaPK != null && !this.professorTurmaPK.equals(other.professorTurmaPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "amanda_gabriel_isabella_lucivania_monica.View.ProfessorTurma[ professorTurmaPK=" + professorTurmaPK + " ]";
    }

    public void addPropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.addPropertyChangeListener(listener);
    }

    public void removePropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.removePropertyChangeListener(listener);
    }
    
}
